package edu.pw.treegrid.server.reportmodel;

import java.util.LinkedList;
import java.util.List;

public class ReportHierarchy {
	private String hierarchyName;
	
	private List<ReportColumn> columns = new LinkedList<ReportColumn>();

	public String getHierarchyName() {
		return hierarchyName;
	}

	public void setHierarchyName(String hierarchyName) {
		this.hierarchyName = hierarchyName;
	}

	public List<ReportColumn> getColumns() {
		return columns;
	}

	public void setColumns(List<ReportColumn> columns) {
		this.columns = columns;
	}
	
	public void addColumn(ReportColumn column) {
		this.columns.add(column);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((hierarchyName == null) ? 0 : hierarchyName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ReportHierarchy other = (ReportHierarchy) obj;
		if (hierarchyName == null) {
			if (other.hierarchyName != null)
				return false;
		} else if (!hierarchyName.equals(other.hierarchyName))
			return false;
		return true;
	}
}
